export const User = {
    state: {
        user: {
            username: '',
            nickname: '',
            avatar: ''
        },
        token: '',
    },
    mutations: {
        updateUser(state, data) {
            state.user = data

        },
        updateToken(state, token) {
            state.token = token

        },
        deleteUser(state) {
            state.user = ""
            state.token = ""
        },

    },
    actions: {
        updateUser({ commit }, data) {
            commit("updateUser", data)
        },
        updateToken({ commit }, token) {
            commit('updateToken', token)
        },
        deleteUser({ commit }) {
            commit('deleteUser')
        }
    }
}